/*
Written by Best Flash Solutions, Inc  
See:
	http://www.bestflashsolutions.com
Contact me: contact@bestflashsolutions.com
*/

/**
 * Manage Events of Streaming Server Red5
 */
package com.bestflashsolutions.red5Streaming
{
	import com.bestflashsolutions.CommonUtils;
	import com.bestflashsolutions.app.Message;
	
	//ManagerEvent of netconnect and netstream 
	public class EventManager  {
		private var _owner: LiveStreaming;
		private var objStreaming: LiveStreaming;
		
		public function EventManager(streaming: LiveStreaming)
		{
			objStreaming = streaming;
		}
	
		public function onBWDone(... rest):void
		{
	        CommonUtils.log("onBWDone");
	    }
	
	    public function onBWCheck(... rest):uint
		{
			CommonUtils.log("onBWCheck");
			//have to return something, so returning anything :)
	        return 0;
		}
	
	    public function onSuccess(result:Object):void
	    {
	        CommonUtils.log("onSuccess got from server : " + result);
	    }
	   
	    public function onFault(fault:Object):void
	    {
			Message.ERR_RTMPSERVER_CANNOT_CONNECT.alert();
	        CommonUtils.log("onFault fault on call , got : " + fault);
	    }
	    
	    public function close(... rest):void {
	    	CommonUtils.log("close");
	    }

		public function onMetaData(metadataObj:Object):void {
			CommonUtils.log("onMetadata");
		}	

		//get size of FLV
		public function setDataFrame(info1: Object, secondPar: Object ):void {
		   CommonUtils.log("setDateFrame");
		   if (info1.toString()=="onMetaData") {
		   		//for future purpose
		   }
		}

		public function onPlayStatus(...rest):void {
			//if end of file, then stop
			if (rest.length==1 && rest[0].code=="NetStream.Play.Complete")
			   	CommonUtils.log("onPlayStatus" + rest.length);
		}
	}
}
